package utils;

public class ColorRGB extends Coordinates {

    public ColorRGB(ColorRGB vec) {
	super(vec.getX(), vec.getY(), vec.getZ());
    }

    public ColorRGB(double[] cords) {
	super(cords[0], cords[1], cords[2]);
    }

    public ColorRGB(double x, double y, double z) {
	super(x, y, z);
    }

    public ColorRGB(int col) {
	super(((col >> 16) & 0xFF) / 255.0, ((col >> 8) & 0xFF) / 255.0, (col & 0xFF) / 255.0);
    }

    public ColorRGB add(ColorRGB col) {
	return new ColorRGB(this.getX() + col.getX(), this.getY() + col.getY(), this.getZ() + col.getZ());
    }

    public ColorRGB multiply(ColorRGB col) {
	return new ColorRGB(this.getX() * col.getX(), this.getY() * col.getY(), this.getZ() * col.getZ());
    }

    public ColorRGB multiply(double factor) {
	return new ColorRGB(this.getX() * factor, this.getY() * factor, this.getZ() * factor);
    }

    public ColorRGB trim() {
	return new ColorRGB(Math.min(this.getX(), 1), Math.min(this.getY(), 1), Math.min(this.getZ(), 1));
    }
}
